//
//  BIZFinanceTaxCircleVC.m
//  ConsultantVersion
//
//  Created by 李小龙 on 2017/3/25.
//  Copyright © 2017年 jieshuibao. All rights reserved.
//

#import "BIZFinanceTaxCircleVC.h"
#import "BIZArticleListCell.h"
#import "BIZArticleDetailVC.h"
#import "BIZArticleModel.h"
#import "MXPagerView.h"
#import "BIZActivityForecastCell.h"
#import "BIZActivityModel.h"
#import "BIZActivityDetailVC.h"
#import "BIZRecruitListCell.h"
#import "BIZRecruitDetailVC.h"
#import "BIZRecruitModel.h"
#import "BIZRecruitCollectionCell.h"

@interface BIZFinanceTaxCircleVC ()<MXSegmentedPagerDelegate,
                                    MXSegmentedPagerDataSource,
                                    MXPagerViewDelegate,
                                    UITableViewDelegate,
                                    UITableViewDataSource,
                                    BIZRecruitListCellDelegate
                                    >


{
    NSInteger _previousSelectedIndex;
//    BIZRecruitListCell *_recruitListCell;
}

@property (nonatomic, strong) MXSegmentedPager  * segmentedPager;
@property (nonatomic, strong) UITableView       * firstTableView;
@property (nonatomic, strong) UITableView       * secondTableView;
@property (nonatomic, strong) UITableView       * thirdTableView;
@property (nonatomic, strong) UITableView       * fourthTableView;
//@property (nonatomic, strong) UITableView       * tableView;
@property (nonatomic, strong) UIWebView        * webView;
/** <#strong属性注释#> */
//@property (nonatomic, strong) NSMutableArray *articleArr;

/** <#strong属性注释#> */
@property (nonatomic, strong) NSMutableArray *firstArticleArr;

/** <#strong属性注释#> */
@property (nonatomic, strong) NSMutableArray *secondArticleArr;

/** <#strong属性注释#> */
@property (nonatomic, strong) NSMutableArray *activityArr;

@property (nonatomic, strong) NSMutableArray *recruitArr;

///** <#assign属性注释#> */
//@property (nonatomic, assign) NSInteger lastID;

/** <#assign属性注释#> */
@property (nonatomic, assign) NSInteger firstLastID;

/** <#assign属性注释#> */
@property (nonatomic, assign) NSInteger secondLastID;

/** <#assign属性注释#> */
@property (nonatomic, assign) NSInteger thirdLastID;

/** <#assign属性注释#> */
@property (nonatomic, assign) NSInteger fourthLastID;

@property (strong, nonatomic) NSMutableArray *positionArr;



@end

@implementation BIZFinanceTaxCircleVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = HEXCOLOR(0xF9F9F9);
    self.firstLastID = 1;
    self.secondLastID = 1;
    self.thirdLastID = 1;
    self.fourthLastID = 1;
    
    _previousSelectedIndex = 1;
    [self.view addSubview:self.segmentedPager];
    [self configNavBar];
    
}


- (void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];

    self.segmentedPager.frame = (CGRect){
        .origin.x       = 0.f,
        .origin.y       = 0.f,
        .size.width     = self.view.frame.size.width,
        .size.height    = self.view.frame.size.height-(self.hiddenTabBar ? 0.0 : 44)
    };
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark <MXSegmentedPagerDelegate>

- (CGFloat)heightForSegmentedControlInSegmentedPager:(MXSegmentedPager *)segmentedPager {
    return 50;
}

- (void)segmentedPager:(MXSegmentedPager *)segmentedPager didSelectViewWithTitle:(NSString *)title {
        NSLog(@"%ld page selected.", (long)segmentedPager.segmentedControl.selectedSegmentIndex);
//    if ((segmentedPager.segmentedControl.selectedSegmentIndex == 1) && !(self.secondArticleArr.count)) {
//        [self loadNew];
//    }
//    _previousSelectedIndex = self.segmentedPager.segmentedControl.selectedSegmentIndex;
}

- (void)segmentedPager:(MXSegmentedPager *)segmentedPager didScrollWithParallaxHeader:(MXParallaxHeader *)parallaxHeader {
//        NSLog(@"progress %f", parallaxHeader.progress);
}

#pragma mark <MXSegmentedPagerDataSource>

- (NSInteger)numberOfPagesInSegmentedPager:(MXSegmentedPager *)segmentedPager {
    return 4;
}

- (NSString *)segmentedPager:(MXSegmentedPager *)segmentedPager titleForSectionAtIndex:(NSInteger)index {
    return @[@"财税资讯", @"新政解读", @"活动预告", @"招聘猎头"][index];
}

- (UIView *)segmentedPager:(MXSegmentedPager *)segmentedPager viewForPageAtIndex:(NSInteger)index {

    DeLog(@"选中的index：%ld",(long)(segmentedPager.segmentedControl.selectedSegmentIndex));
    
    return @[self.firstTableView, self.secondTableView, self.thirdTableView, self.fourthTableView][index];
}

#pragma mark <UITableViewDelegate>

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
        BIZArticleListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BIZArticleListCell" forIndexPath:indexPath];
        if (self.firstArticleArr.count >= indexPath.row) {
            cell.articleModel = self.firstArticleArr[indexPath.row];
        }
        return cell;
        
    } else  if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 1) {
        BIZArticleListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BIZArticleListCell" forIndexPath:indexPath];
        
        if (self.secondArticleArr.count >= indexPath.row) {
            cell.articleModel = self.secondArticleArr[indexPath.row];
        }
        
        return cell;
        
    }  else  if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 2) {
        BIZActivityForecastCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BIZActivityForecastCell" forIndexPath:indexPath];
        if (self.activityArr.count >= indexPath.row) {
            cell.activityModel = self.activityArr[indexPath.row];
        }
        
        return cell;
        
    }

    BIZRecruitListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BIZRecruitListCell" forIndexPath:indexPath];
    BIZRecruitModel *model = self.recruitArr[indexPath.row];
    cell.recruitModel = model;
//    cell.delegate = self;
    
    MPWeakSelf(self);
    cell.didSelectCollectionViewItemBlock = ^(NSIndexPath *indexPath) {
        BIZRecruitDetailVC *vc = [BIZRecruitDetailVC viewControllerFromStoryboard];
        vc.positionModel = [model.hires objectAtIndex:indexPath.row];
        [weakself.navigationController pushViewController:vc animated:YES];
    };
    DeLog(@"cell的高度：%f",cell.height);
    return cell;
}

#pragma mark <UITableViewDataSource>

- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
        return self.firstArticleArr.count;
    } else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 1) {
        return self.secondArticleArr.count;
    }  else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 2) {
        return self.activityArr.count;
    }
    
    return self.recruitArr.count;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 2) {
        BIZActivityModel *model = self.activityArr[indexPath.row];
        BIZActivityDetailVC *vc = [[BIZActivityDetailVC alloc]init];
        vc.activityModel = model;
        [self.navigationController pushViewController:vc animated:YES];
        
        return;
        
    } else if (self.segmentedPager.segmentedControl.selectedSegmentIndex  == 3) {
      
        return;
        
    }

    BIZArticleDetailVC *detailVC = [BIZArticleDetailVC viewControllerFromStoryboard];
    BIZArticleModel *model;
    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
        
        if (self.firstArticleArr.count >= indexPath.row) {
            model = self.firstArticleArr[indexPath.row];
        }

    } else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 1) {
        
        if (self.secondArticleArr.count >= indexPath.row) {
             model = self.secondArticleArr[indexPath.row];
        }
       
    }
    
    detailVC.articleModel = model;
    
    MPWeakSelf(self);
    detailVC.commentSuccessReturnBlcok = ^() {
        model.discussNum = model.discussNum + 1;
        if (weakself.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
            [weakself.firstTableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
        } else {
            [weakself.secondTableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
        }
    };
    [self.navigationController pushViewController:detailVC animated:YES];
}


//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
////    if (self.segmentedPager.segmentedControl.selectedSegmentIndex < 3) {
////        return UITableViewAutomaticDimension;
////    }
//     return UITableViewAutomaticDimension;
//    
////    return [tableView fd_heightForCellWithIdentifier:@"BIZRecruitListCell" cacheByIndexPath:indexPath configuration:^(BIZRecruitListCell *cell) {
////        BIZRecruitModel *model = self.recruitArr[indexPath.row];
////        cell.recruitModel = model;
////
////    }];
//}


- (void)loadNew {
    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
        self.firstLastID = 1;
        [self.firstArticleArr removeAllObjects];
        [self.firstTableView.mj_footer resetNoMoreData];
    } else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 1) {
       self.secondLastID = 1;
       [self.secondArticleArr removeAllObjects];
       [self.secondTableView.mj_footer resetNoMoreData];
        
    } else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 2) {
        self.thirdLastID = 1;
        [self.activityArr removeAllObjects];
        [self.thirdTableView.mj_footer resetNoMoreData];
        
    } else {
        self.fourthLastID = 1;
        [self.recruitArr removeAllObjects];
        [self.fourthTableView.mj_footer resetNoMoreData];
        [self.fourthTableView reloadData];
    }

    [self loadArticleListData];
}

- (void)loadMore {
    [self loadArticleListData];
}

- (void)stopRefresh {
    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
        !self.firstTableView.mj_header.isRefreshing ? : self.firstTableView.mj_header.endRefreshing;
        !self.firstTableView.mj_footer.isRefreshing ? : self.firstTableView.mj_footer.endRefreshing;
        
    } else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 1)  {
        !self.secondTableView.mj_header.isRefreshing ? : self.secondTableView.mj_header.endRefreshing;
        !self.secondTableView.mj_footer.isRefreshing ? : self.secondTableView.mj_footer.endRefreshing;
        
    }  else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 2)  {
        !self.thirdTableView.mj_header.isRefreshing ? : self.thirdTableView.mj_header.endRefreshing;
        !self.thirdTableView.mj_footer.isRefreshing ? : self.thirdTableView.mj_footer.endRefreshing;
        
    } else {
        !self.fourthTableView.mj_header.isRefreshing ? : self.fourthTableView.mj_header.endRefreshing;
        !self.fourthTableView.mj_footer.isRefreshing ? : self.fourthTableView.mj_footer.endRefreshing;
        
    }
   
}


- (void)loadArticleListData {
    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 2) {
        [self loadActivityListData];
        return;
        
    } else if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 3) {
        [self loadRecruitList];
        return;
    }
    
    NSMutableDictionary *paramDic = [NSMutableDictionary dictionary];
    
    paramDic[@"type"] = @"label";
    if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
        paramDic[@"uuid"] = @"1";
        paramDic[@"pageIndex"] = @(self.firstLastID);
        paramDic[@"pageEnd"] = @(self.firstLastID+9);
    } else  if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 1) {
        paramDic[@"uuid"] = @"2";
        paramDic[@"pageIndex"] = @(self.secondLastID);
        paramDic[@"pageEnd"] = @(self.secondLastID+9);
    }
    
    
    [MBProgressHUD showAnimationHUD];
    DeLog(@"paramDic%@",paramDic);
    DeLog(@"当前选中的Index++:%ld",(long)self.segmentedPager.segmentedControl.selectedSegmentIndex);
    [RequestTool POST:kArticleListUrl parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        DeLog(@":responseObject:%@",responseObject);
        [self stopRefresh];
        BIZArticleListModel *listModel = [BIZArticleListModel yy_modelWithJSON:responseObject];
        if (listModel.code == 1) {
            [MBProgressHUD hideHUD];
            
            if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 0) {
                
                if (!listModel.articleArr.count) {
                    self.firstTableView.mj_footer.state = MJRefreshStateNoMoreData;
                    return ;
                }
                
                [self.firstArticleArr addObjectsFromArray:listModel.articleArr];
                self.firstLastID += self.firstArticleArr.count;
                [self.firstTableView reloadData];
                
            } else  if (self.segmentedPager.segmentedControl.selectedSegmentIndex == 1) {
                if (!listModel.articleArr.count) {
                    self.secondTableView.mj_footer.state = MJRefreshStateNoMoreData;
                   
                    return ;
                }
                
                [self.secondArticleArr addObjectsFromArray:listModel.articleArr];
                self.secondLastID += self.secondArticleArr.count;
                [self.secondTableView reloadData];
            }
            
        } else {
            [MBProgressHUD showErrorMessage:listModel.des];
            if (listModel.code == 2) {
                BIZLoginViewController *vc = [BIZLoginViewController viewControllerFromStoryboard];
                MPWeakSelf(self);
                vc.loginSuccessBlock = ^(){
                    [weakself loadNew];
                };
                [self presentViewController:vc animated:YES completion:nil];
            }
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        DeLog(@"error:%@",error);
        [self stopRefresh];
        if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable) {
            [MBProgressHUD showErrorMessage:@"网络不给力"];
        }
        else {
            [MBProgressHUD showErrorMessage:@"服务器繁忙"];
        }

    }];
}


- (void)loadRecruitList {
    NSMutableDictionary *paramDic = [NSMutableDictionary dictionary];
    paramDic[@"pageIndex"] = @(self.fourthLastID);
    paramDic[@"pageEnd"] = @(self.fourthLastID+9);
    
    [MBProgressHUD showAnimationHUD];
    
    DeLog(@"当前选中的Index++:%ld",(long)self.segmentedPager.segmentedControl.selectedSegmentIndex);
    [RequestTool POST:kRecruitListUrl parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        DeLog(@"招聘数据：responseObject:%@",responseObject);
        [self stopRefresh];
        BIZRecruitListModel *listModel = [BIZRecruitListModel yy_modelWithJSON:responseObject];
        if (listModel.code == 1) {
            [MBProgressHUD hideHUD];
            if (!listModel.data.count) {
                self.fourthTableView.mj_footer.state = MJRefreshStateNoMoreData;
                return ;
            }
            
            [self.recruitArr addObjectsFromArray:listModel.data];
            self.fourthLastID += self.recruitArr.count;
            
            [self.fourthTableView reloadData];
            
        } else {
            [MBProgressHUD showErrorMessage:listModel.des];
            if (listModel.code == 2) {
                BIZLoginViewController *vc = [BIZLoginViewController viewControllerFromStoryboard];
                MPWeakSelf(self);
                vc.loginSuccessBlock = ^(){
                    [weakself loadNew];
                };
                [self presentViewController:vc animated:YES completion:nil];
            }
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        DeLog(@"error:%@",error);
        [self stopRefresh];
        if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable) {
            [MBProgressHUD showErrorMessage:@"网络不给力"];
        }
        else {
            [MBProgressHUD showErrorMessage:@"服务器繁忙"];
        }
        
    }];
}

- (void)loadActivityListData {
    NSMutableDictionary *paramDic = [NSMutableDictionary dictionary];
    paramDic[@"pageIndex"] = @(self.thirdLastID);
    paramDic[@"pageEnd"] = @(self.thirdLastID+9);
    
    [MBProgressHUD showAnimationHUD];

    DeLog(@"当前选中的Index++:%ld",(long)self.segmentedPager.segmentedControl.selectedSegmentIndex);
    [RequestTool POST:kActivityListUrl parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        DeLog(@"responseObject:%@",responseObject);
        [self stopRefresh];
        BIZActivityListModel *listModel = [BIZActivityListModel yy_modelWithJSON:responseObject];
        if (listModel.code == 1) {
            [MBProgressHUD hideHUD];
            if (!listModel.activityArr.count) {
                self.thirdTableView.mj_footer.state = MJRefreshStateNoMoreData;
                return ;
            }
            
            [self.activityArr addObjectsFromArray:listModel.activityArr];
            self.thirdLastID += self.activityArr.count;
            
            [self.thirdTableView reloadData];

        } else {
            [MBProgressHUD showErrorMessage:listModel.des];
            if (listModel.code == 2) {
                BIZLoginViewController *vc = [BIZLoginViewController viewControllerFromStoryboard];
                MPWeakSelf(self);
                vc.loginSuccessBlock = ^(){
                    [weakself loadNew];
                };
                [self presentViewController:vc animated:YES completion:nil];
            }
        }
        
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        DeLog(@"error:%@",error);
        [self stopRefresh];
        if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable) {
            [MBProgressHUD showErrorMessage:@"网络不给力"];
        }
        else {
            [MBProgressHUD showErrorMessage:@"服务器繁忙"];
        }
        
    }];
}


- (void)pagerView:(MXPagerView *)pagerView willMoveToPage:(UIView *)page atIndex:(NSInteger)index {
    if ((self.segmentedPager.segmentedControl.selectedSegmentIndex == 1) && !(self.secondArticleArr.count)) {
        [self loadNew];
        return;
    }
    
    if ((self.segmentedPager.segmentedControl.selectedSegmentIndex == 2) && !(self.activityArr.count)) {
        [self loadNew];
        return;
    }
    
    
    if ((self.segmentedPager.segmentedControl.selectedSegmentIndex == 3) && !(self.recruitArr.count)) {
        [self loadNew];
        return;
    }
    
    
//    if (index >= 3) {
//        
//        [MBProgressHUD showTipMessageInWindow:@"敬请期待"];
//        return;
//    }
}


- (void)pagerView:(MXPagerView *)pagerView didMoveToPage:(UIView *)page atIndex:(NSInteger)index {
    _previousSelectedIndex = index;
}


- (void)configNavBar {
    UILabel *label = [[UILabel alloc]init];
    label.textColor = [UIColor whiteColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.frame = CGRectMake(0, 0, App_Frame_Width, 40);
    label.text = @"财税圈";
    self.navigationItem.titleView =  label;

}

- (MXSegmentedPager *)segmentedPager {
    if (!_segmentedPager) {
        _segmentedPager = [[MXSegmentedPager alloc] init];
        _segmentedPager.segmentedControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
        _segmentedPager.segmentedControl.backgroundColor = [UIColor whiteColor];
        _segmentedPager.segmentedControl.selectionIndicatorHeight = 2;
        _segmentedPager.segmentedControl.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor blackColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:14]};
        _segmentedPager.segmentedControl.selectedTitleTextAttributes = @{NSForegroundColorAttributeName : HEXCOLOR(0x2079ef), NSFontAttributeName:[UIFont boldSystemFontOfSize:14]};
        _segmentedPager.segmentedControl.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe;
        _segmentedPager.segmentedControl.selectionIndicatorColor = HEXCOLOR(0x2079ef);
        
        _segmentedPager.bounces = NO;
        _segmentedPager.delegate    = self;
        _segmentedPager.dataSource  = self;
        _segmentedPager.pager.delegate = self;
        _segmentedPager.pager.scrollEnabled = NO;
        [_segmentedPager.pager registerClass:[UITableView class] forPageReuseIdentifier:@"tableViewPage"];
    }
    return _segmentedPager;
}

- (UITableView *)firstTableView {
    if (!_firstTableView) {
        _firstTableView = [[UITableView alloc] init];
        _firstTableView.delegate = self;
        _firstTableView.dataSource = self;
        _firstTableView.rowHeight = UITableViewAutomaticDimension;
        _firstTableView.backgroundColor = HEXCOLOR(0xE6E6E6);
        _firstTableView.estimatedRowHeight = 200;
        _firstTableView.showsVerticalScrollIndicator = NO;
        _firstTableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
        
        [_firstTableView registerNib:[UINib nibWithNibName:@"BIZArticleListCell" bundle:nil] forCellReuseIdentifier:@"BIZArticleListCell"];
        //
        _firstTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNew)];
        _firstTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)];
        [self loadNew];
    }
    
    return _firstTableView;
}


- (UITableView *)secondTableView {
    if (!_secondTableView) {
        _secondTableView = [[UITableView alloc] init];
        _secondTableView.delegate = self;
        _secondTableView.dataSource = self;
        _secondTableView.rowHeight = UITableViewAutomaticDimension;
        _secondTableView.backgroundColor = HEXCOLOR(0xE6E6E6);
        _secondTableView.estimatedRowHeight = 300;
        _secondTableView.showsVerticalScrollIndicator = NO;
        _secondTableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
        
        [_secondTableView registerNib:[UINib nibWithNibName:@"BIZArticleListCell" bundle:nil] forCellReuseIdentifier:@"BIZArticleListCell"];
        //
        _secondTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNew)];
        _secondTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)];
        
    }
    
    return _secondTableView;
}


- (UITableView *)thirdTableView {
    if (!_thirdTableView) {
        _thirdTableView = [[UITableView alloc] init];
        _thirdTableView.delegate = self;
        _thirdTableView.dataSource = self;
        _thirdTableView.rowHeight = UITableViewAutomaticDimension;
        _thirdTableView.backgroundColor = HEXCOLOR(0xE6E6E6);
        _thirdTableView.estimatedRowHeight = 300;
        _thirdTableView.showsVerticalScrollIndicator = NO;
        _thirdTableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
        
        [_thirdTableView registerNib:[UINib nibWithNibName:@"BIZActivityForecastCell" bundle:nil] forCellReuseIdentifier:@"BIZActivityForecastCell"];
        //
        _thirdTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNew)];
        _thirdTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)];
        
    }
    
    return _thirdTableView;
}


- (UITableView *)fourthTableView {
    if (!_fourthTableView) {
        _fourthTableView = [[UITableView alloc] init];
        _fourthTableView.delegate = self;
        _fourthTableView.dataSource = self;
        _fourthTableView.backgroundColor = HEXCOLOR(0xE6E6E6);
        _fourthTableView.rowHeight = UITableViewAutomaticDimension;
        _fourthTableView.estimatedRowHeight = 300;
        _fourthTableView.showsVerticalScrollIndicator = NO;
        _fourthTableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero];
    
        [_fourthTableView registerNib:[UINib nibWithNibName:NSStringFromClass([BIZRecruitListCell class]) bundle:nil] forCellReuseIdentifier:@"BIZRecruitListCell"];
        _fourthTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNew)];
        _fourthTableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMore)];
    }
    
    return _fourthTableView;
}

//
//- (void)shouldReload {
//    [self.fourthTableView reloadData];
//}

- (NSMutableArray *)firstArticleArr {
    if (!_firstArticleArr) {
        _firstArticleArr = [NSMutableArray array];
    }
    
    return _firstArticleArr;
}


- (NSMutableArray *)secondArticleArr {
    if (!_secondArticleArr) {
        _secondArticleArr = [NSMutableArray array];
    }
    
    return _secondArticleArr;
}

- (NSMutableArray *)activityArr {
    if (!_activityArr) {
        _activityArr = [NSMutableArray array];
    }
    
    return _activityArr;
}


- (NSMutableArray *)recruitArr {
    if (!_recruitArr) {
        _recruitArr = [NSMutableArray array];
    }
    
    return _recruitArr;
}



@end
